package com.breeze.components.socket.redis.action;

import com.alibaba.fastjson2.JSONObject;
import com.breeze.components.socket.WebSocket;
import com.breeze.components.socket.WebSocketManager;
import java.util.Map;

/**
 * { "action":"remove", "identifier":"xxx" } 删除action
 *
 * @author breeze
 */
public class RemoveAction implements Action {

  @Override
  public void doMessage(WebSocketManager manager, JSONObject object) {
    if (!object.containsKey(IDENTIFIER)) {
      return;
    }
    String identifier = object.getString(IDENTIFIER);
    Map<String, WebSocket> localWebSocketMap = manager.localWebSocketMap();
    localWebSocketMap.remove(identifier);
  }
}
